<template>
  <div class="chart-block">
    <div class="chart-header">
      <span class="chart-title">{{ title }}</span>
      <slot name="filters"></slot>
    </div>
    <slot name="content"></slot>
  </div>
</template>

<script setup lang="ts">
interface Props {
  title: string;
}

defineProps<Props>();
</script>

<style scoped>
.chart-block {
  flex: 1;
  background: #fff;
  border-radius: 20px;
  padding: 36px 36px 44px 36px;
  box-shadow: 0 6px 32px 0 rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.chart-title {
  font-size: 20px;
  font-weight: 700;
  color: #222;
}

.chart-filters {
  display: flex;
  gap: 12px;
}

.chart-filters select {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px 22px;
  font-size: 16px;
  color: #666;
  background: #fafbfc;
  transition: border 0.2s;
}

.chart-filters select:focus {
  border: 1.5px solid #1890ff;
  outline: none;
}

.chart-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 36px;
  width: 100%;
  min-height: 340px;
}

.chart-echarts {
  width: 360px;
  height: 300px;
  min-width: 240px;
  min-height: 200px;
  background: #f7f8fa;
  border-radius: 16px;
  margin-top: 8px;
  position: relative;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.03);
}

.y-axis-label {
  position: absolute;
  left: -60px;
  top: 50px;
  font-size: 15px;
  color: #888;
  transform: rotate(-90deg);
  transform-origin: left bottom;
}

@media (max-width: 1200px) {
  .chart-content {
    flex-direction: column;
    gap: 16px;
  }
}
</style> 